﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package com.gaiaonline.monster.view {
    import com.gaiaonline.monster.model.*;
    import com.gaiaonline.monster.events.*;
    import com.gaiaonline.monster.service.sound.*;
    import gaia.moga.monster.model.*;
    import com.gaiaonline.monster.service.*;
    import org.robotlegs.mvcs.*;
    import com.gaiaonline.monster.view.components.tutorial.*;
    import com.gaiaonline.monster.model.tracking.*;

    public class BattleTutorialMediator extends Mediator {

		[Inject]
        public var view:BattleTutorial;
		[Inject]
        public var tracking:OmnitureService;
		[Inject]
        public var sounds:SoundService;
		[Inject]
        public var music:MusicService;
		[Inject]
        public var ranch:HomeRanchModel;
		[Inject]
        public var mogas:MogaFactory;

        override public function onRegister():void{
            dispatch(new TrackingEvent(TrackingEvent.TRACK, TrackingType.START_TUTORIAL));
            this.view.complete.addOnce(this.onComplete);
            this.view.track.add(this.onTrack);
            this.view.nameMonster.add(this.onNameMonster);
            this.setSounds();
        }
        private function setSounds():void{
            this.music.loadAndPlay("sounds/basic_tutorial.mp3", true);
        }
        private function onTrack(_arg1:String):void{
            dispatch(new TrackingEvent(TrackingEvent.TRACK, ("tut_" + _arg1)));
        }
        private function onNameMonster(_arg1:String):void{
            var _local2:String = this.ranch.mogas[1].id;
            dispatch(new TeamEvent(TeamEvent.NAME_MONSTER, {id:_local2, monsterName:_arg1}));
        }
        private function onComplete():void{
            dispatch(new TrackingEvent(TrackingEvent.PARTNER_PIXEL, PartnerPixelType.SOMETRICS));
            dispatch(new TrackingEvent(TrackingEvent.PARTNER_PIXEL, PartnerPixelType.DOUBLE_CLICK));
            dispatch(new TrackingEvent(TrackingEvent.PARTNER_PIXEL, PartnerPixelType.NANIGANS));
            dispatch(new TrackingEvent(TrackingEvent.PARTNER_PIXEL, PartnerPixelType.LIFESTREET));
            dispatch(new TrackingEvent(TrackingEvent.TRACK, TrackingType.END_TUTORIAL));
            dispatch(new ApplicationEvent(ApplicationEvent.SET_STATE, ApplicationState.WORLD));
        }

    }
}//package com.gaiaonline.monster.view 
